var g = (name, template, jsPath, filename, chunks) => { chunks = chunks || []; chunks = chunks.concat(["manifest", name]); return { name, template, jsPath, filename, chunks } };
const pageConfigs = [];
const devPageConfigs = [];

const chunks1 = ["vendors", 'framework'];

//*配置
//html页配置
const htmlPageConfigs = {
    "index": {
        chunks: chunks1,
        htmls: ['index', 'login', 'preview', 'adminUserEdit']
    }
};

//通用js配置,priority:优先级，值大优先打包，第三方需优先项目中通用js打包
const commonJsConfigs = [
    { name: "vendors", test: /[\\/]node_modules[\\/]/ },
    {
        name: "framework",
        test: /[\\/]src[\\/](utils-common|dva-common|use-hooks|components|controls|data-actions|event-actions|page-templates|configs|a2dmah5)[\\/]/
    }
];

//别名
const alias = {
    UtilsCommon: './src/utils-common/index.js',
    DvaCommon: './src/dva-common/index.js',
    UseHooks: './src/use-hooks/index.js',
    Components: './src/components/index.js',
    Controls: './src/controls/index.js',
    DataActions: './src/data-actions/index.js',
    EventActions: './src/event-actions/index.js',
    PageTemplates: './src/page-templates/index.js',
    Configs: './src/configs/index.js',
    a2dmah5: './src/a2dmah5/index.js'
}

//复制路径列表
const copyPathList = [
];

const copyConfigs = [];

for (var p in htmlPageConfigs) {
    const template = `./src/${p}.ejs`;
    const template_prod = `./src/${p}_prod.ejs`;
    const jsPath = `./src/${p}.js`;
    const filename = `${p}.html`;
    var chunks = htmlPageConfigs[p].chunks || [];
    chunks = chunks.concat([p, "manifest"]);

    htmlPageConfigs[p].htmls.forEach(html => {
        devPageConfigs.push({ name: html, template, jsPath, filename: `${html}.html`, chunks })
    });
    pageConfigs.push({ name: p, template: template_prod, jsPath, filename, chunks });
}

copyPathList.forEach(c => copyConfigs.push({ from: `./src/${c}`, to: c }));

module.exports = { pageConfigs, alias, commonJsConfigs, devPageConfigs, copyConfigs };